/**
 * Created by Jay on 2016/6/15.
 */
function version_control(){
    mccmsa.ajax({
        url: "versionManageController/getAllVersionInfo",
        method: "get",
        data: {pageSize: 10, pageNo: 1},
        success: function (data) {
            //if(data.result.pageCount==)
            if(data.result.pageCount==undefined){
            }else{
                create_page({
                    url:"versionManageController/getAllVersionInfo",
                    temp:"getColumnTableData_version",
                    contain:"#ColumnTableData_version",
                    data:data,
                    method:"get"
                })//生成分页
            }
            //console.log(data.result.pageCount==undefined);
            //console.log(data);
            set_seqsum(
                {
                    pageNo:data.result.pageNo,
                    pageSize:data.result.pageSize
                }
            );
            //console.log(data);
            mccmsa.getHtmlFromLocalTemplate({   //将数据打包到模版丢进容器
                templateId: "getColumnTableData_version",
                container: $("#ColumnTableData_version"),
                data: data,
                callback: function () {
                }
            })

        }
    })
    $("body").off();
    $("body").on("click",".add_version_m",function(){
        //mccmsa.ajax({
        //    url: "versionManageController/addNewVersionInfo",
        //    method: "get",
        //    data: {pageSize: 10, pageNo: 1},
        //    success: function (data) {
        //
        //    }
        //})
        mccmsa.goTo("add_version");
    })
    //data-id
    $("body").on("click",".edit_version_m",function(){
        var id=$(this).attr("data-id");
        mccmsa.goTo("edit_version","version_control",{id:id});
    })
    $("body").on("click",".delet_version_m",function(){
        var id=$(this).attr("data-id");
        layer.open({
            content: '是否删除',
            btn: ['确认', '取消'], //可以无限个按钮
            yes: function(index, layero){
                mccmsa.ajax({
                    url: "versionManageController/delVersionInfo",
                    method: "get",
                    data: {id:id},
                    success: function (data) {
                      layer.alert("成功删除");
                        mccmsa.hashChange();
                    }
                })
            },
            no : function(index, layero){
                layer.close(index); //如果设定了yes回调，需进行手工关闭
            }
        });

    })
}